﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
namespace BaoJian.member.myinfo
{
    /// <summary>
    /// 修改密码
    /// </summary>
    public partial class ChangePwd : System.Web.UI.Page
    {
        private string UserID;
        protected void Page_Load(object sender, EventArgs e)
        {
            UserID = HttpContext.Current.User.Identity.Name;
            if (!Page.IsPostBack)
            {
                BaoJian.Tools.Common.IsAuthenticated();
            }
        }

        protected void Save_Click(object sender, EventArgs e)
        {
            MembershipUser User = Membership.GetUser(UserID);
            string oldPWD = User.GetPassword();
            if (oldPWD != oldPassword.Value.Trim())
            {
                Message.InnerText = "旧密码错误"+oldPWD;
                return;
            }

            User.ChangePassword(oldPWD, password1.Value.Trim());

            Message.InnerText = "修改成功";
            Message.Visible = true;
            ShowInfo.Visible = false;
        }
    }
}
